use clap::Parser as _;
use lycoris::{Settings, args::CompilerArgs, prelude::*};

fn main() {
    let args = CompilerArgs::parse();
    let settings = Settings::try_from(args).unwrap_or_else(|e| {
        eprintln!("Error initializing settings: {}", e);
        std::process::exit(1)
    });
    let mut pipeline = CompilerPipeline::new(settings);
    // println!("[PIPELINE] {pipeline:#?}");
    match pipeline.run() {
        Ok(_) => {
            // 成功执行
        }
        Err(e) => {
            eprintln!("Compilation error: {}", e);
            std::process::exit(1);
        }
    }
}
